package com.javaee.ex05.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class LoginCheckAspect {
    @Pointcut("execution(* com.javaee.ex05.service.impl.UserServiceImpl.*(..))")
    public void pointcut() {}
    @Before("pointcut()")
    public void loginCheck(JoinPoint joinPoint) {
        System.out.println("在前置通知中检查用户名和密码的有效性");
        System.out.println("目标类：" + joinPoint.getTarget());
        System.out.println("目标方法：" + joinPoint.getSignature().getName());
    }
}
